import { request as r } from '../request'
// 某些接口需要formdata类型
const headers = { 'Content-Type': 'multipart/form-data' }
export default {
  login: (data) => r({ data, url: '/login' }),
  getInfo: (token) =>
    r({
      method: 'get',
      url: '/getInfo',
      headers: {
        Authorization: 'Bearer ' + token
      }
    }),
  getRoutes: () => r({ method: 'get', url: '/menu/getPermissions' }),
  updatePwd: (data) => r({ data, url: '/user/updatePwd', headers }),
  updateUserInfo: (data) => r({ data, url: '/user/updateUserInfo' }),
  // 菜单管理接口
  getMenuList: (data) => r({ data, url: '/menu/page' }),
  addMenu: (data) => r({ data, url: '/menu' }),
  editMenu: (data) => r({ data, url: '/menu', method: 'put' }),
  delMenu: (data) => r({ data, url: '/menu', method: 'delete' }),
  // 角色管理接口
  getRoleList: (data) => r({ data, url: '/role/page', headers }),
  addRole: (data) => r({ data, url: '/role' }),
  editRole: (data) => r({ data, url: '/role', method: 'put' }),
  delRole: (data) => r({ data, url: '/role', method: 'delete' }),
  getRoleInfo: (data) => r({ data, url: '/role', method: 'get' }),
  roleAddPer: (data) => r({ data, url: '/role/bindPermission' }),
  // 用户管理接口
  getUserList: (data) => r({ data, url: '/user/page', headers }),
  addUser: (data) => r({ data, url: '/user' }),
  editUser: (data) => r({ data, url: '/user', method: 'put' }),
  delUser: (data) => r({ data, url: '/user', method: 'delete' }),
  getUserInfo: (data) => r({ data, url: '/user', method: 'get' }),
  resetUserPwd: (data) => r({ data, url: '/user/resetPwd', method: 'get' }),
  getDepTree: (data) => r({ data, url: '/user/getDepartmentTree', method: 'get' }),
  getNewest: (data) => r({ data, url: '/user/live/statistics/page', method: 'post' }),
  // APP用户管理
  getAppUserList: (data) => r({ data, url: '/app/member/page' }),
  setPurchaser: (data) => r({ data, url: '/member/set/purchaser', method: 'get' }),
  setAdmin: (data) => r({ data, url: '/member/set/admin', method: 'get' }),
  setUserAuto: (data) => r({ data, url: '/member/set/other', method: 'post' }),
  // 数据字典管理接口
  getDictList: (data) => r({ data, url: '/constant/page', headers }),
  addDict: (data) => r({ data, url: '/constant' }),
  editDict: (data) => r({ data, url: '/constant', method: 'put' }),
  delDict: (data) => r({ data, url: '/constant', method: 'delete' }),
  // 电子秤接口
  getEleScaleList: (data) => r({ data, url: '/eleScale/page', headers }),
  addEleScale: (data) => r({ data, url: '/eleScale' }),
  editEleScale: (data) => r({ data, url: '/eleScale', method: 'put' }),
  delEleScale: (data) => r({ data, url: '/eleScale', method: 'delete' }),
  // 设备管理接口
  getDeviceList: (data) => r({ data, url: '/device/page', headers }),
  addDevice: (data) => r({ data, url: '/device' }),
  editDevice: (data) => r({ data, url: '/device', method: 'put' }),
  delDevice: (data) => r({ data, url: '/device', method: 'delete' }),
  getDeviceInfo: (data) => r({ data, url: '/device', method: 'get' }),
  // 设备巡检接口
  getDevInsList: (data) => r({ data, url: '/devicePatrolInspection/page', headers }),
  addDevIns: (data) => r({ data, url: '/devicePatrolInspection' }),
  editDevIns: (data) => r({ data, url: '/devicePatrolInspection', method: 'put' }),
  delDevIns: (data) => r({ data, url: '/devicePatrolInspection', method: 'delete' }),
  getDevInsInfo: (data) => r({ data, url: '/devicePatrolInspection', method: 'get' }),
  // 设备维修接口
  getDevRepList: (data) => r({ data, url: '/deviceRepair/page', headers }),
  addDevRep: (data) => r({ data, url: '/deviceRepair' }),
  editDevRep: (data) => r({ data, url: '/deviceRepair', method: 'put' }),
  delDevRep: (data) => r({ data, url: '/deviceRepair', method: 'delete' }),
  getDevRepInfo: (data) => r({ data, url: '/deviceRepair', method: 'get' }),
  // 部门管理接口
  getDepList: (data) => r({ data, url: '/department/tree' }),
  addDep: (data) => r({ data, url: '/department' }),
  editDep: (data) => r({ data, url: '/department', method: 'put' }),
  delDep: (data) => r({ data, url: '/department', method: 'delete' }),
  getDepInfo: (data) => r({ data, url: '/department', method: 'get' }),
  // 预警规则接口
  getRuleList: (data) => r({ data, url: '/deviceWarnRule/page', headers }),
  addRule: (data) => r({ data, url: '/deviceWarnRule' }),
  editRule: (data) => r({ data, url: '/deviceWarnRule', method: 'put' }),
  delRule: (data) => r({ data, url: '/deviceWarnRule', method: 'delete' }),
  getRuleInfo: (data) => r({ data, url: '/deviceWarnRule', method: 'get' }),
  getPropsFromDev: (data) => r({ data, url: '/deviceWarnRule/getDeviceProperty', method: 'get' }),
  // 监控管理接口
  getCameraList: (data) => r({ data, url: '/camera/page', headers }),
  addCamera: (data) => r({ data, url: '/camera' }),
  editCamera: (data) => r({ data, url: '/camera', method: 'put' }),
  delCamera: (data) => r({ data, url: '/camera', method: 'delete' }),
  getCameraInfo: (data) => r({ data, url: '/camera', method: 'get' }),
  getCameraConfig: (data) => r({ data, url: '/cameraConfig', method: 'get' }),
  editCameraConfig: (data) => r({ data, url: '/cameraConfig' }),
  // 产品管理接口
  getProductList: (data) => r({ data, url: '/product/page', headers }),
  addProduct: (data) => r({ data, url: '/product' }),
  editProduct: (data) => r({ data, url: '/product', method: 'put' }),
  delProduct: (data) => r({ data, url: '/product', method: 'delete' }),
  getProductInfo: (data) => r({ data, url: '/product', method: 'get' }),
  // 地块分组接口
  getMassifGroupList: (data) => r({ data, url: '/massifGroup/page', headers }),
  addMassifGroup: (data) => r({ data, url: '/massifGroup' }),
  editMassifGroup: (data) => r({ data, url: '/massifGroup', method: 'put' }),
  delMassifGroup: (data) => r({ data, url: '/massifGroup', method: 'delete' }),
  getMassifGroupInfo: (data) => r({ data, url: '/massifGroup', method: 'get' }),
  // 地块管理接口
  getMassifList: (data) => r({ data, url: '/platform/land/page' }),
  addMassif: (data) => r({ data, url: '/platform/land/add' }),
  editMassif: (data) => r({ data, url: '/platform/land/update' }),
  delMassif: (data) => r({ data, url: `/platform/land/delete/${data.id}`, method: 'get' }),
  getMassifInfo: (data) => r({ data, url: `/platform/land/detail/${data.id}`, method: 'get' }),
  getAllMassif: (data) => r({ data, url: '/platform/land/all', method: 'get' }),

  // 作物管理接口
  getCropsList: (data) => r({ data, url: '/crops/page', headers }),
  addCrops: (data) => r({ data, url: '/crops' }),
  editCrops: (data) => r({ data, url: '/crops', method: 'put' }),
  delCrops: (data) => r({ data, url: '/crops', method: 'delete' }),
  getCropsInfo: (data) => r({ data, url: '/crops', method: 'get' }),
  // 作物类别接口
  getPlantingCategoryList: (data) => r({ data, url: '/plantingCategory/page', headers }),
  addPlantingCategory: (data) => r({ data, url: '/plantingCategory' }),
  editPlantingCategory: (data) => r({ data, url: '/plantingCategory', method: 'put' }),
  delPlantingCategory: (data) => r({ data, url: '/plantingCategory', method: 'delete' }),
  getPlantingCategoryInfo: (data) => r({ data, url: '/plantingCategory', method: 'get' }),
  // 种植计划接口
  getPlantingPlanList: (data) => r({ data, url: '/plantingPlan/page', headers }),
  addPlantingPlan: (data) => r({ data, url: '/plantingPlan' }),
  editPlantingPlan: (data) => r({ data, url: '/plantingPlan', method: 'put' }),
  delPlantingPlan: (data) => r({ data, url: '/plantingPlan', method: 'delete' }),
  getPlantingPlanInfo: (data) => r({ data, url: '/plantingPlan', method: 'get' }),
  // 种植计划详情接口
  getPlanDetailList: (data) => r({ data, url: '/planDetail/listByPlan', method: 'get' }),
  addPlanDetail: (data) => r({ data, url: '/planDetail' }),
  editPlanDetail: (data) => r({ data, url: '/planDetail', method: 'put' }),
  delPlanDetail: (data) => r({ data, url: '/planDetail', method: 'delete' }),
  getPlanDetailInfo: (data) => r({ data, url: '/planDetail', method: 'get' }),
  nextStep: (data) => r({ data, url: '/planDetail/endCurrentStage', method: 'get' }),
  // 种植台账接口
  getPlantingLedgerList: (data) => r({ data, url: '/plantingLedger/page', headers }),
  addPlantingLedger: (data) => r({ data, url: '/plantingLedger' }),
  editPlantingLedger: (data) => r({ data, url: '/plantingLedger', method: 'put' }),
  delPlantingLedger: (data) => r({ data, url: '/plantingLedger', method: 'delete' }),
  getPlantingLedgerInfo: (data) => r({ data, url: '/plantingLedger', method: 'get' }),
  // 农机设备管理
  getMachineList: (data) => r({ data, url: '/agricul/machine/device/page' }),
  addMachine: (data) => r({ data, url: '/agricul/machine/device/add' }),
  editMachine: (data) => r({ data, url: '/agricul/machine/device/update' }),
  delMachine: (data) =>
    r({ data, url: `/agricul/machine/device/delete/${data.id}`, method: 'get' }),
  getMachineInfo: (data) =>
    r({ data, url: `/agricul/machine/device/detail/${data.id}`, method: 'get' }),
  getMachineRunLine: (data) => r({ data, url: '/agricul/machine/device/gps/List' }),
  // 农机管理
  getMachinList: (data) => r({ data, url: '/agricul/machine/page' }),
  addMachin: (data) => r({ data, url: '/agricul/machine/add' }),
  editMachin: (data) => r({ data, url: '/agricul/machine/update' }),
  delMachin: (data) => r({ data, url: `/agricul/machine/delete/${data.id}`, method: 'get' }),
  getMachinInfo: (data) => r({ data, url: `/agricul/machine/detail/${data.id}`, method: 'get' }),
  getMachinWorkType: (data) => r({ data, url: '/SysWorkType/getList' }),
  addWorkType: (data) => r({ data, url: '/SysWorkType/add' }),
  delWorkType: (data) => r({ data, url: '/SysWorkType/delete' }),
  // 维修工单
  getOrdList: (data) => r({ data, url: '/machine/service/order/page' }),
  addOrd: (data) => r({ data, url: '/machine/service/order/add' }),
  editOrd: (data) => r({ data, url: '/machine/service/order/update' }),
  delOrd: (data) => r({ data, url: `/machine/service/order/delete/${data.id}`, method: 'get' }),
  getOrdInfo: (data) => r({ data, url: `/machine/service/order/detail/${data.id}`, method: 'get' }),
  // 耕作工单
  getFarList: (data) => r({ data, url: '/farming/work/order/page' }),
  addFar: (data) => r({ data, url: '/farming/work/order/add' }),
  editFar: (data) => r({ data, url: '/farming/work/order/update' }),
  delFar: (data) => r({ data, url: `/farming/work/order/delete/${data.id}`, method: 'get' }),
  getFarInfo: (data) => r({ data, url: `/farming/work/order/detail/${data.id}`, method: 'get' }),
  getLywzList: (data) => r({ data, url: '/goodsInventoryApply/page' }),
  getXzczs: (data) => r({ data, url: '/assist/mem/list', method: 'get' }),
  getXznj: (data) => r({ data, url: '/assist/mch/list', method: 'get' }),
  //导出耕作/farming/work/order/export
  exportGz: (data) => r({ data, url: '/farming/work/order/export' }),
  // 质量管理
  getZlList: (data) => r({ data, url: '/qualityControl/page' }),
  addZl: (data) => r({ data, url: '/qualityControl/add' }),
  editZl: (data) => r({ data, url: '/qualityControl/update' }),
  delZl: (data) => r({ data, url: `/qualityControl/delete/${data.id}`, method: 'get' }),
  getZlInfo: (data) => r({ data, url: `/qualityControl/detail/${data.id}`, method: 'get' }),
  // 产品宣传
  getXcList: (data) => r({ data, url: '/qualityControl/page' }),
  addXc: (data) => r({ data, url: '/qualityControl/add' }),
  editXc: (data) => r({ data, url: '/qualityControl/update' }),
  delXc: (data) => r({ data, url: `/qualityControl/delete/${data.id}`, method: 'get' }),
  getXcInfo: (data) => r({ data, url: `/qualityControl/detail/${data.id}`, method: 'get' }),
  // 结算设置
  getJsszList: (data) => r({ data, url: '/settlementSet/page' }),
  addJssz: (data) => r({ data, url: '/settlementSet/add' }),
  editJssz: (data) => r({ data, url: '/settlementSet/update' }),
  delJssz: (data) => r({ data, url: `/settlementSet/delete/${data.id}`, method: 'get' }),
  getJsszInfo: (data) => r({ data, url: `/settlementSet/detail/${data.id}`, method: 'get' }),
  // 金额结算
  getJejsList: (data) => r({ data, url: '/farming/work/order/settlement/page' }),
  // 产品宣传
  getCpxcList: (data) => r({ data, url: '/productPromotion/page' }),
  addCpxc: (data) => r({ data, url: '/productPromotion/add' }),
  editCpxc: (data) => r({ data, url: '/productPromotion/update' }),
  delCpxc: (data) => r({ data, url: `/productPromotion/delete/${data.id}`, method: 'get' }),
  getCpxcInfo: (data) => r({ data, url: `/productPromotion/detail/${data.id}`, method: 'get' }),
  // 农事管理
  getNsglList: (data) => r({ data, url: '/farmingManage/page' }),
  addNsgl: (data) => r({ data, url: '/farmingManage/add' }),
  editNsgl: (data) => r({ data, url: '/farmingManage/update' }),
  delNsgl: (data) => r({ data, url: `/farmingManage/delete/${data.id}`, method: 'get' }),
  getNsglInfo: (data) => r({ data, url: `/farmingManage/detail/${data.id}`, method: 'get' }),
  // 作物管理
  getZwglList: (data) => r({ data, url: '/cropType/page' }),
  addZwgl: (data) => r({ data, url: '/cropType/add' }),
  editZwgl: (data) => r({ data, url: '/cropType/update' }),
  delZwgl: (data) => r({ data, url: `/cropType/delete/${data.id}`, method: 'get' }),
  getZwglInfo: (data) => r({ data, url: `/cropType/detail/${data.id}`, method: 'get' }),
  // 采购订单
  getCgddList: (data) => r({ data, url: '/procureOrders/page' }),
  addCgdd: (data) => r({ data, url: '/procureOrders/add' }),
  editCgdd: (data) => r({ data, url: '/procureOrders/update' }),
  delCgdd: (data) => r({ data, url: `/procureOrders/delete/${data.id}`, method: 'get' }),
  getCgddInfo: (data) => r({ data, url: `/procureOrders/detail/${data.id}`, method: 'get' }),
  // 物资管理
  getWuziList: (data) =>
    r({
      data,
      url: `/goodsInventory/detail/by/${data.outBigTypeId}/${data.outSmallTypeId}`,
      method: 'get'
    }),
  // 出入库
  getCrkList: (data) => r({ data, url: '/goodsInventory/one/page' }),
  addCrk: (data) => r({ data, url: '/goodsInventory/add' }),
  editCrk: (data) => r({ data, url: '/goodsInventory/update' }),
  delCrk: (data) => r({ data, url: `/goodsInventory/delete/${data.id}`, method: 'get' }),
  getCrkInfo: (data) => r({ data, url: `/goodsInventory/detail/${data.id}`, method: 'get' }),
  // 农资管理
  getNzList: (data) => r({ data, url: '/assets/goods/page' }),
  addNz: (data) => r({ data, url: '/assets/goods/add' }),
  editNz: (data) => r({ data, url: '/assets/goods/update' }),
  delNz: (data) => r({ data, url: `/assets/goods/delete/${data.id}`, method: 'get' }),
  getNzInfo: (data) => r({ data, url: `/assets/goods/detail/${data.id}`, method: 'get' }),
  //选取农资后获取商品名称数据
  getSelectNz: (data) => r({ data, url: '/assets/goods/getClickData', method: 'get' }),

  // 库存管理
  getKcList: (data) => r({ data, url: '/goodsInventory/page' }),
  //农资超市库存管理
  getCsList: (data) => r({ data, url: '/inventory/market/page' }),
  getCsxq: (data) => r({ data, url: '/inventory/market/history/page' }),
  editCs: (data) => r({ data, url: '/inventory/market/update' }),
  addCs: (data) => r({ data, url: '/inventory/market/add' }),
  exitCs: (data) => r({ data, url: '/inventory/market/export' }),
  delCs: (data) => r({ data, url: `/inventory/market/delete/${data.id}`, method: 'get' }),
  delCsXq: (data) => r({ data, url: `/inventory/market/history/delete/${data.id}`, method: 'get' }),

  // 销售管理
  getXsList: (data) => r({ data, url: '/goods/order/page' }),
  addXs: (data) => r({ data, url: '/goods/order/pcAdd' }),
  editXs: (data) => r({ data, url: '/goods/order/update' }),
  delXs: (data) => r({ data, url: `/goods/order/delete/${data.id}`, method: 'get' }),
  getXsInfo: (data) => r({ data, url: `/goods/order/detail/${data.id}`, method: 'get' }),
  changeState: (data) => r({ data, url: '/goods/order/status' }),
  importToState: (data) => r({ data, url: '/goods/order/status' }),
  updateToPay: (data) => r({ data, url: '/goods/order/update' }),
  //导出
  exportList: (data) => r({ data, url: '/goods/order/export' }),
  // 审批管理
  getSpList: (data) => r({ data, url: '/approveRecord/my' }),
  examine: (data) => r({ data, url: '/approveRecord/examine' }),
  // 审批设置
  getSpszList: (data) => r({ data, url: '/approveSet/page' }),
  addSpsz: (data) => r({ data, url: '/approveSet/add' }),
  editSpsz: (data) => r({ data, url: '/approveSet/update' }),
  delSpsz: (data) => r({ data, url: `/approveSet/delete/${data.id}`, method: 'get' }),
  getSpszInfo: (data) => r({ data, url: `/approveSet/detail/${data.id}`, method: 'get' }),
  // 操作日志
  getCzrzList: (data) => r({ data, url: `/monitor/operlog/list`, method: 'get' }),
  // 消息记录
  getXxjlList: (data) => r({ data, url: `/message/page` }),
  // 轮播设置
  getLbtList: (data) => r({ data, url: '/banner/page' }),
  addLbt: (data) => r({ data, url: '/banner/add' }),
  editLbt: (data) => r({ data, url: '/banner/update' }),
  delLbt: (data) => r({ data, url: `/banner/delete/${data.id}`, method: 'get' }),
  getLbtInfo: (data) => r({ data, url: `/banner/detail/${data.id}`, method: 'get' }),
  // 培训管理
  getPxglList: (data) => r({ data, url: '/platform/train/page' }),
  addPxgl: (data) => r({ data, url: '/platform/train/add' }),
  editPxgl: (data) => r({ data, url: '/platform/train/update' }),
  delPxgl: (data) => r({ data, url: `/platform/train/delete/${data.id}`, method: 'get' }),
  getPxglInfo: (data) => r({ data, url: `/platform/train/detail/${data.id}`, method: 'get' }),
  getPxbmList: (data) => r({ data, url: '/platform/train/apply/page' }),

  //大屏数据配置
  getDpList: (data) => r({ data, url: `/screen/config/detail/1`, method: 'get' }),
  editDpList: (data) => r({ data, url: `/screen/config/update/`, method: 'post' }),
  getDpProductList: (data) => r({ data, url: `/screen/config/detail/2`, method: 'get' }),
  getDpkeySaleList: (data) => r({ data, url: `/screen/config/detail/3`, method: 'get' }),
  getDpPlantList: (data) => r({ data, url: `/screen/config/detail/4`, method: 'get' })
}
